/*
 ------ preDefined pre attached source ------
 
 #ifdef GL_FRAGMENT_PRECISION_HIGH
 precision highp float;
 #else
 precision mediump float;
 #endif
 
 

 uniform float       iGlobalTime;
 uniform int         iFrame;
 uniform vec3        iChannelResolution[4];

 uniform vec4        iMouse;                // mouse pixel coords. xy: current (if MLB down), zw: click
 #ifdef USE_STRENGTH
 uniform float       iStrength;
 #endif
 
 
 uniform vec2        iResolution;
 uniform bool        iOneToOne;
 
 varying vec2        v_texCoord;
 
 uniform sampler2D   iChannel0;
 uniform sampler2D   iChannel1;
 uniform sampler2D   iChannel2;
 uniform sampler2D   iChannel3;
 
 vec4 texture(     sampler2D   s, vec2 c)                   { return texture2D(s,c); }
 vec4 texture(     sampler2D   s, vec2 c, float b)          { return texture2D(s,c,b); }
 vec4 texture(     samplerCube s, vec3 c )                  { return textureCube(s,c); }
 vec4 texture(     samplerCube s, vec3 c, float b)          { return textureCube(s,c,b); }
 
 ----------------------------------------------
 */

void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
    float offset = 0.0;
    float yOffset = 0.20;
    if(iOneToOne){
        offset = 0.13;
    }
    vec2 normalizationCoord = v_texCoord;
    if (v_texCoord.y>0.5) {
        normalizationCoord.y = normalizationCoord.y-0.5+yOffset;
         fragColor = texture2D(iChannel0, fract(normalizationCoord));
    }else{
        normalizationCoord.y = normalizationCoord.y-offset+yOffset-0.08;
         fragColor = texture2D(iChannel1, fract(normalizationCoord));
    }
    
   // fragColor =vec4(1.0,0.0,0.0,1.0);
}


/*
------ preDefined post attached source ------
 
void main( void )
{
    vec4 color = vec4(0.0);
    vec2 fragCoord = gl_FragCoord.xy;

    mainImage( color, fragCoord );

    gl_FragColor = color;
}
 
----------------------------------------------
*/
